package com.android.vgongyi.view;

import android.content.Context;
import android.graphics.Bitmap;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.android.vgongyi.R;

public class VerifyIconView extends RelativeLayout{
	
	private ImageView imv;
	private ImageView verImv;

	public VerifyIconView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		this.init(context);
	}
	

	public VerifyIconView(Context context, AttributeSet attrs) {
		super(context, attrs);
		this.init(context);
	}

	public VerifyIconView(Context context) {
		super(context);
	
	}
	
	private void init(Context context){
		
		
		this.imv = new ImageView(context);
		this.imv.setBackgroundResource(R.drawable.weibosina);
		RelativeLayout.LayoutParams params1 = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
		
		this.imv.setLayoutParams(params1);
		this.addView(this.imv);
		
		this.verImv = new ImageView(context);
		this.verImv.setBackgroundResource(R.drawable.verified);
		RelativeLayout.LayoutParams params2 = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
		params2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
		params2.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
		this.verImv.setLayoutParams(params2);
		this.addView(this.verImv);
		
		showVerIconWithFlag(true);
	}
	
	public void setIconContent(Bitmap bit){
		this.imv.setImageBitmap(bit);
	}
	
	public void showVerIconWithFlag(boolean flag){
		if(flag)
			this.verImv.setVisibility(View.VISIBLE);
		else 
			this.verImv.setVisibility(View.GONE);
	}

}
